<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="{{isSWY?'赠送订单':'销售单'}}" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addApply()" ng-disabled="!btnPermission.salesOrderAdd" title="{{!btnPermission.salesOrderAdd?'无权限执行此操作':''}}" translate>新增</button>
                    <button class="btn btn-operate" ng-click="batchDel()" ng-disabled="!btnPermission.salesOrderDel" title="{{!btnPermission.salesOrderDel?'无权限执行此操作':''}}" translate>删除</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                                ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                        <div class="btn btn-default base-color" ng-if="!!btnPermission.salesOrderExport">
                            <div title="导出">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                            <ul class="more-tool">
                                <li yb-download download-url="exportParam.sectionUrl" download-param="exportParam.sectionParam"
                                    download-key="ids">
                                    <i class="yb-icon ico-export-o"></i> 导出
                                </li>
                                <li yb-download download-url="exportParam.allUrl" download-param="condition" download-duration="3">
                                    <i class="yb-icon ico-export-o"></i> 导出全部
                                </li>
                            </ul>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="销售单号"
                               ng-model="condition.salesBillNo">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)" reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">销售单号：</label>
                        <textarea ng-model="condition.salesBillNo" class="form-control" placeholder="逗号分隔或者换行分隔" ></textarea>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">借用单号：</label>
                        <input type="text" ng-model="condition.borrowBillNo" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">CRM单号</label>
                        <input type="text" ng-model="condition.crmOrder" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">客户名称：</label>
                        <input type="text" ng-model="condition.clientName" class="form-control">
                    </div>

                    <div class="form-group clearfix">
                        <label class="control-label">服务人员：</label>
                        <input type="text" ng-model="condition.servicePersonName" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">订单类型：</label>
                        <select class="form-control" ng-model="condition.billType">
                            <option value="">请选择</option>
                            <option value="1">普通</option>
                            <option value="2">三包</option>
                            <option value="3">赠送</option>
                            <option value="4">其他</option>
                        </select>
                    </div>
                    <div class="form-group clearfix m-b-none">
                        <label class="control-label">出库时间：</label>
                        <input type="text" class="form-control date-picker" ng-model="condition.startOutboundDate"
                               datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchDataPicker(0)" is-open="datePickerFlag[0]" close-text="关闭"
                               ng-change="checkDate(condition, 'startOutboundDate', 'endOutboundDate')" modal-size="small" readonly>
                    </div>
                    <div class="form-group clearfix m-b-none">
                        <label class="control-label"></label>
                        <label class="control-label wave-line">~</label>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"></label>
                        <input type="text" class="form-control date-picker" ng-model="condition.endOutboundDate"
                               datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchDataPicker(1)" is-open="datePickerFlag[1]" close-text="关闭"
                               ng-change="checkDate(condition, 'startOutboundDate', 'endOutboundDate')" modal-size="small" readonly>
                    </div>

                    <div class="form-group clearfix">
                        <label class="control-label">服务单号：</label>
                        <input type="text" ng-model="condition.serviceNo" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">派工单号：</label>
                        <input type="text" ng-model="condition.workOrderNo" class="form-control">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">是否竞品客户：</label>
                        <select class="form-control" ng-model="condition.isCompetingDealer">
                            <option value="">请选择</option>
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="true"
                 has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                            <tr>
                                <th width="40" class="text-center th-check border-l-none">
                                    <div yb-check-box yb-checked="markInfo.allCheckedBill" yb-click="selectAll(dataList, 'Bill')"></div>
                                </th>
                                <th ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-click="toSort(tableConfig.tableCol, $index)" ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth" fixed-width="tbStyle.billFixedWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-click="toSort(tableConfig.tableCol, $index)" ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.cueRow}" ng-click="selectRow($index)">
                                <td width="40" class="text-center border-l-none">
                                    <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item, dataList, 'Bill')"></div>
                                </td>
                                <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                    width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                    title="{{item[itemCol.dataField]}}">
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <!--ng-disabled="item.guaraenteesStatus != '0' && item.guaraenteesStatus != '3' || !btnPermission.guaranteesApplyEdit"-->
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="editApply(item)"
                                                ng-disabled="item.createOutboundStatus != 0||!btnPermission.salesOrderEdit || item.billSource == 'crmV2' "
                                                title="{{!btnPermission.salesOrderEdit?'无权限执行此操作':''}}">编辑</button>
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="delApply(item.id)"
                                                ng-disabled="item.createOutboundStatus != 0||!btnPermission.salesOrderDel || item.billSource == 'crmV2'"
                                                title="{{!btnPermission.salesOrderDel?'无权限执行此操作':''}}">删除</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.cueRow}"
                                ng-click="selectRow($index)">
                                <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !itemCol.isFixed" title="{{item[itemCol.dataField]}}">
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="auditApply(item)"
                                                ng-disabled="item.guaraenteesStatus != '1' || !btnPermission.guaranteesApplyAudit"
                                                title="{{!btnPermission.guaranteesApplyAudit?'无权限执行此操作':''}}">审核</button>
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="editApply(item)"
                                                ng-disabled="item.guaraenteesStatus != '0' && item.guaraenteesStatus != '3' || !btnPermission.guaranteesApplyEdit"
                                                title="{{!btnPermission.guaranteesApplyEdit?'无权限执行此操作':''}}">编辑</button>
                                        <button type="button" class="btn btn-operate m-r-xs" ng-click="delApply(item.id)"
                                                ng-disabled="item.outEnable == 2 || !btnPermission.guaranteesApplyDel"
                                                title="{{!btnPermission.guaranteesApplyDel?'无权限执行此操作':''}}">删除</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-check-box class="m-t-xs m-r-sm" yb-checked="markInfo.allCheckedBill" yb-check-name="全选"
                     yb-click="selectAll(dataList, 'Bill')"></div>
                <button class="btn btn-operate" ng-click="batchDel()"  ng-disabled="!btnPermission.salesOrderDel"
                        title="{{!btnPermission.salesOrderDel?'无权限执行此操作':''}}">删除</button>
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[2]" ng-if="activeFlag[2]">
            <form name="orderForm" class="m-t-sm form-horizontal form-up-tb border-b clearfix" novalidate>

                <div class="form-group col-xs-3 m-b-sm" ng-if="!!orderObj.borrowBillNo">
                    <label class="col-xs-4 control-label max-w-100">借用单号：</label>
                    <label class="col-xs-8 control-label p-l-n text-left spill-dots">
                        {{orderObj.borrowBillNo}}
                    </label>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>订单类型：</label>
                    <div class="col-xs-8 wrapper-none">
                        <div dictionary-selector is-disabled="tabFlag.type==2||isSWY" ng-model="orderObj.billTypeStr" sel-code="orderObj.billType" sel-key="BILLTYPE">
                            <input type="text" ng-disabled="tabFlag.type==2||isSWY" name="billType" class="form-control light-bg" ng-model="orderObj.billTypeStr"
                                   placeholder="请选择" required readonly yb-focus>
                        </div>
                        <div class="msg-block" ng-show="orderForm.billType.$dirty || (orderForm.billType.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.billType.$error.required && !orderForm.billType.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>客户名称：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="clientName" class="form-control light-bg" ng-model="orderObj.clientName"
                               ng-click="selectDealer()" required yb-focus readonly placeholder="请选择" >

                        <div class="msg-block" ng-if="orderForm.clientName.$dirty || (orderForm.clientName.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.clientName.$error.required && !orderForm.clientName.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm" ng-if="!isSWY">
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>销售人员：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="servicePersonName" class="form-control light-bg" ng-model="orderObj.servicePersonName"
                               ng-click="selectServicer()" required yb-focus readonly placeholder="请选择">

                        <div class="msg-block" ng-if="orderForm.servicePersonName.$dirty || (orderForm.servicePersonName.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.servicePersonName.$error.required && !orderForm.servicePersonName.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm" >
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>机型：</label>
                    <div class="col-xs-8 wrapper-none">
                        <select name="models" class="form-control"
                                ng-model="orderObj.model"
                                ng-disabled="!orderObj.clientName||!orderObj.useMachineNo"
                                ng-options="item as item.name for item in modelList track by item.code"
                                required yb-focus>
                            <option value="">请选择</option>
                        </select>

                        <div class="msg-block" ng-if="orderForm.models.$dirty || (orderForm.models.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.models.$error.required && !orderForm.models.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm" >
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>使用整机编号：</label>
                    <div class="col-xs-8 wrapper-none">
                        <select name="useMachineNo" class="form-control"
                                ng-model="orderObj.useMachineNo"
                                ng-disabled="!orderObj.clientName"
                                ng-change="changeModel()"
                                ng-options="item as item.name for item in machineNoList track by item.code"
                                required yb-focus>
                            <option value="">请选择</option>
                        </select>

                        <div class="msg-block" ng-if="orderForm.useMachineNo.$dirty || (orderForm.useMachineNo.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.useMachineNo.$error.required && !orderForm.useMachineNo.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>


                <div class="form-group col-xs-3 m-b-sm" ng-if="orderObj.billType==billTypeEnum.Give">
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>结算整机编号：</label>
                    <div class="col-xs-8 wrapper-none">
                        <select name="settleMachineNo" class="form-control"
                                ng-model="orderObj.settleMachineNo"
                                ng-disabled="!orderObj.useMachineNo"
                                ng-options="item as item.name for item in machineNoList track by item.name"
                                ng-change="changeRemainingCredit()"
                                required yb-focus>
                            <option value="">请选择</option>
                        </select>

                        <div class="msg-block" ng-if="orderForm.settleMachineNo.$dirty || (orderForm.settleMachineNo.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.settleMachineNo.$error.required && !orderForm.settleMachineNo.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm"  ng-if="orderObj.billType==billTypeEnum.ThreePack">
                    <label class="col-xs-4 control-label max-w-100">索赔单号：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="claimOrderNo" class="form-control light-bg" maxlength="20"
                               ng-model="orderObj.claimOrderNo" yb-focus>
                    </div>
                </div>


                <div class="form-group col-xs-3 m-b-sm" ng-if="orderObj.billType==billTypeEnum.Give">
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>赠送额度类型：</label>
                    <div class="col-xs-8 wrapper-none">
                        <div dictionary-selector ng-model="orderObj.giveQuotaTypeStr" sel-code="orderObj.giveQuotaType" option-changed="getRemainingCredit()" sel-key="CREDIT">
                            <input type="text" name="giveQuotaType" class="form-control light-bg" ng-model="orderObj.giveQuotaTypeStr"
                                   placeholder="请选择" required readonly yb-focus>
                        </div>
                        <div class="msg-block" ng-show="orderForm.giveQuotaType.$dirty || (orderForm.giveQuotaType.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.giveQuotaType.$error.required && !orderForm.giveQuotaType.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm" ng-if="orderObj.billType==billTypeEnum.Give">
                    <label class="col-xs-4 control-label max-w-100">剩余赠送额度：</label>
                    <label class="col-xs-8 control-label p-l-n text-left spill-dots">
                        {{orderObj.remainingCredit}}
                    </label>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">派工单号：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="workOrderNo" class="form-control" ng-model="orderObj.workOrderNo">
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">收货人：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="consignee" class="form-control" ng-model="orderObj.consignee" maxlength="20" yb-focus>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">联系方式：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="contactPhone" class="form-control" ng-model="orderObj.contactPhone" maxlength="50" yb-focus>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">邮箱：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="email" class="form-control" ng-model="orderObj.emailAddress" yb-email yb-focus maxlength="50">
                        
                        <div class="msg-block" ng-show="orderForm.email.$dirty || (orderForm.email.$invalid && submitted)">
                            <div class="error-msg" ng-show="orderForm.email.$error.email && !orderForm.email.focused">
                                <div class="msg-triangle"></div>
                                <span translate>邮箱格式错误</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">主机厂：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" class="form-control light-bg" ng-model="orderObj.factoryOrgName" ng-click="selectFactory()" readonly placeholder="请选择" >
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">收货地址：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="receiptAddress" class="form-control" ng-model="orderObj.receiptAddress" maxlength="50" yb-focus>
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100"><i>*</i>原因：</label>
                    <div class="col-xs-8 wrapper-none">
                        <div dealer-dictionary-selector ng-model="orderObj.reason" sel-key="BORROWREASON">
                            <input type="text" name="reason" class="form-control light-bg" ng-model="orderObj.reason"
                                   placeholder="请选择" required readonly yb-focus>
                        </div>
                        <div class="msg-block" ng-show="orderForm.reason.$dirty || (orderForm.reason.$invalid && submitted)">
                            <div class="error-msg" ng-if="orderForm.reason.$error.required && !orderForm.reason.focused">
                                <div class="msg-triangle"></div>
                                必填项，请填写
                            </div>
                        </div>
                    </div>
                </div>



                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">备注：</label>
                    <div class="col-xs-8 wrapper-none">
                        <input type="text" name="remark" class="form-control" ng-model="orderObj.remark" maxlength="200">
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">销售渠道：</label>
                    <div class="col-xs-8 wrapper-none">
                        <select class="form-control" ng-model="orderObj.saleType" ng-options="item.value as item.name for item in salesChannelList">
                            <option value="">请选择</option>
                        </select>
                    </div>
                </div>

                <div class="form-group col-xs-12" style="margin: 0">
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">订单总价：</label>
                    <label class="col-xs-8 control-label p-l-n text-left spill-dots" title="{{orderObj.totalOrderPrice}}">
                        {{orderObj.totalOrderPrice}}
                    </label>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 control-label max-w-100">调整总价：</label>
                    <label class="col-xs-8 control-label p-l-n text-left spill-dots" title="{{orderObj.adjustedTotalPrice}}">
                        {{orderObj.adjustedTotalPrice}}
                    </label>
                </div>
                <div class="form-group col-xs-3 m-b-sm" ng-if="!!costPriceShow">
                    <label class="col-xs-4 control-label max-w-100">成本总价：</label>
                    <label class="col-xs-8 control-label p-l-n text-left spill-dots" title="{{orderObj.costTotal}}">
                        {{orderObj.costTotal}}
                    </label>
                </div>
            </form>
            <div class="row wrapper-y-xs">
                <div class="col-xs-12 operate-bar font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="selMateriel($event)">选择零件</button>
                    <button class="btn btn-operate m-r-sm" ng-click="importMateriel()">导入零件</button>
                    <button class="btn btn-operate m-r-sm" ng-click="batchDelMateriel()">批量删除</button>
                    <div class="pull-right m-r-xs" title="{{!btnPermission.showCostPrice?'无权限执行此操作':''}}">
                        <label class="font-12 m-r-xs">显示成本价:</label>
                        <toggle ng-model="costPriceShow" yb-disabled="!btnPermission.showCostPrice"></toggle>
                    </div>
                </div>
            </div>
            <div materiel-selector show-toolbar="toolbarConfig.showMateriel" selected-list="orderObj.detailVOList"
                 goal-type="salesSlip"></div>

            <div class="main-area d-b-60" ng-style="{top:orderObj.billType==billTypeEnum.Give?'345px':'305px'}">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{materielTableConfig.scrollWidth}}">
                            <thead>
                            <tr>
                                <th width="40" class="th-check text-center">
                                    <div yb-check-box yb-checked="markInfo.allCheckedMaterial"
                                         yb-click="selectAll(orderObj.detailVOList, 'Material')"></div>
                                </th>
                                <th width="60">
                                    操作
                                </th>
                                <th ng-repeat="itemCol in materielTableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-if="!itemCol.hidden&&(itemCol.type!=='cost'||costPriceShow)">
                                    <div yb-thead-operate ng-model="itemCol" target-width="materielTableConfig.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="orderObj.detailVOList.length > 0">
                        <table class="table-fixed border-none" width="{{materielTableConfig.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in orderObj.detailVOList track by $index">
                                <td width="40" class="text-center">
                                    <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item, orderObj.detailVOList, 'Material')"></div>
                                </td>
                                <td width="60">
                                    <button type="button" class="btn btn-operate" ng-click="delMateriel(item, $index, $event)">删除</button>
                                </td>
                                <td ng-repeat="itemCol in materielTableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-if="!itemCol.hidden&&(itemCol.type!=='cost'||costPriceShow)" ng-class="{'wrapper-none': itemCol.inputType === 'func'}">
                                    <div class="spill-dots" ng-if="!itemCol.input" title="{{item[itemCol.dataField]}}">
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <span ng-if="!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                        </span>
                                    </div>

                                    <div ng-if="itemCol.input && itemCol.inputType === 'num'" class="td-edit pos-r" title="{{item[itemCol.dataField]}}">
                                        <input type="text" class="form-control" ng-model="item[itemCol.dataField]" ng-change="setPrice(item, itemCol.dataField)" yb-number-input
                                               max="99999999.99"  disable-decimal="false" decimal-places="3"
                                               ng-class="{'error': item.qtyErr}">
                                        <div class="pos-a tool-tips" ng-if="!!item.qtyErr">
                                            <i class="triangle"></i>
                                            <div class="msg">申请数量不能为空和0</div>
                                        </div>
                                    </div>

                                    <div yb-form-clear class="td-edit" ng-model="item[itemCol.dataField]" select-obj="chosePriceScheme(item, $parent.$parent.$parent.$index)"
                                         clear-form="clearPriceScheme(item)" tips-name="价格方案" ng-if="!!itemCol.input && itemCol.inputType === 'func'"
                                         title="{{item[itemCol.dataField]}}"></div>


                                    <div ng-if="itemCol.input && itemCol.inputType === 'price'" class="td-edit pos-r"
                                         title="{{item[itemCol.dataField]}}">
                                        <input type="text" class="form-control edit" ng-model="item[itemCol.dataField]" ng-change="setAdjustPrice(item, itemCol.dataField)"
                                               yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                               ng-class="{'error': item.priceAdjustErr}">
                                        <div class="pos-a tool-tips" ng-if="!!item.priceAdjustErr">
                                            <i class="triangle"></i>
                                            <div class="msg">调整后单价不能为空和0</div>
                                        </div>
                                    </div>

                                    <div ng-if="itemCol.input && itemCol.inputType === 'checkbox'" class="text-center">
                                        <div yb-check-box yb-checked="item['isChecked']"
                                             yb-click="checkItem(item, itemCol.dataField)"></div>
                                    </div>

                                    <div ng-if="itemCol.input && itemCol.inputType === 'time'" class="td-edit pos-r"
                                         title="{{item[itemCol.dataField]}}">
                                        <input type="text" class="form-control date-picker cursor-pointer"
                                               ng-model="item[itemCol.dataField]" datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="switchListDatePicker(item)"
                                               at-right="true" is-open="item.showDatePicker" close-text="关闭"
                                               ng-class="{'error': item.dateErr && !item[itemCol.dataField]}" readonly>
                                        <div class="pos-a tool-tips" ng-if="!!item.dateErr && !item[itemCol.dataField]">
                                            <i class="triangle"></i>
                                            <div class="msg">发货日期不能为空</div>
                                        </div>
                                    </div>
                                    <div ng-if="itemCol.input && itemCol.inputType === 'note'" class="td-edit pos-r"
                                         title="{{item[itemCol.dataField]}}">
                                        <input type="text" name="remark" class="form-control" ng-model="item[itemCol.dataField]" maxlength="60">
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="orderObj.detailVOList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData('save', orderForm.$valid,submitEnum.Save)">保存</button>
                <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData('submit', orderForm.$valid,submitEnum.Submit)">提交</button>
                <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
            </div>
        </div>
        <div tab heading="详情" active="activeFlag[3]" ng-if="activeFlag[3]">
            <div class="m-t-sm form-up-tb clearfix">
                <div ng-if="!!orderObj.borrowBillNo" class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">借用单号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.borrowBillNo}}">
                        {{orderObj.borrowBillNo}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">销售单订单号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.salesBillNo||'-'}}">
                        {{orderObj.salesBillNo || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">客户名称：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.clientName||'-'}}">
                        {{orderObj.clientName||'-'}}
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">销售人员：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.servicePersonName||'-'}}">
                        {{orderObj.servicePersonName||'-'}}
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">订单类型：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.billTypeStr||'-'}}">
                        {{orderObj.billTypeStr||'-'}}
                    </div>
                </div>

                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">申请日期：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(orderObj.createDate|YbDate:'yyyy-MM-dd HH:mm:ss')||'-'}}">
                        {{(orderObj.createDate|YbDate:'yyyy-MM-dd HH:mm:ss') || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">收货人：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.consignee ||'-'}}">
                        {{orderObj.consignee || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">联系方式：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.contactPhone ||'-'}}">
                        {{orderObj.contactPhone || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">邮箱：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.emailAddress ||'-'}}">
                        {{orderObj.emailAddress || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">主机厂：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.emailAddress ||'-'}}">
                        {{orderObj.factoryOrgName || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">收货地址：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.receiptAddress||'-'}}">
                        {{orderObj.receiptAddress|| "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">机型：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.model||'-'}}">
                        {{orderObj.model || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">使用整机编号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.useMachineNo || '-'}}">
                        {{orderObj.useMachineNo || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">结算整机编号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.settleMachineNo || '-'}}">
                        {{orderObj.settleMachineNo}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">派工单号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.workOrderNo||'-'}}">
                        {{orderObj.workOrderNo || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">原因：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.reason||'-'}}">
                        {{orderObj.reason || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm" ng-if="orderObj.billType=='2'">
                    <label class="col-xs-4 m-b-n text-right max-w-100" ng-style="{'margin-top':orderObj.claimOrderNo?0:'-2px'}">索赔单号：</label>
                    <div ng-if="!orderObj.claimOrderNo" class="col-xs-8 wrapper-none spill-dots" style="margin-top:-4px;">
                        <input type="text" class="form-control add-claim-input" ng-model="orderObj.addClaimOrderNo" maxlength="20">
                        <button ng-click="addClaimOrder(orderObj.id)" class="btn btn-warning btn-xs add-claim-btn">补录</button>
                    </div>
                    <div ng-if="orderObj.claimOrderNo" class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.claimOrderNo}}">
                        {{orderObj.claimOrderNo}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm" ng-if="orderObj.billType=='3'">
                    <label class="col-xs-4 m-b-n text-right max-w-100">赠送额度类型：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.giveQuotaTypeStr||'-'}}">
                        {{orderObj.giveQuotaTypeStr || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm" ng-if="orderObj.billType=='3'">
                    <label class="col-xs-4 m-b-n text-right max-w-100">剩余赠送额度：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.remainingCredit||'-'}}">
                        {{orderObj.remainingCredit===0?'-':orderObj.remainingCredit}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">备注：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.remark||'-'}}">
                        {{orderObj.remark || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">订单总价：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.totalOrderPrice||'-'}}">
                        {{orderObj.totalOrderPrice || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">调整后总价：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.adjustedTotalPrice||'-'}}">
                        {{orderObj.adjustedTotalPrice || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm" ng-if="!!costPriceShow">
                    <label class="col-xs-4 m-b-n text-right max-w-100">成本总价：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.costTotal||'-'}}">
                        {{orderObj.costTotal || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">服务单号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.serviceNo||'-'}}">
                        {{orderObj.serviceNo || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">是否竞品客户：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.isCompetingDealer | TrueOrFalse}}">
                        {{orderObj.isCompetingDealer | TrueOrFalse}}
                    </div>
                </div>
            </div>
            <div class="row wrapper-y-xs">
                <div class="col-xs-12 operate-bar font-0">
                    <div class="pull-right m-r-xs" title="{{!btnPermission.showCostPrice?'无权限执行此操作':''}}">
                        <label class="font-12 m-r-xs">显示成本价:</label>
                        <toggle ng-model="costPriceShow" yb-disabled="!btnPermission.showCostPrice"></toggle>
                    </div>
                </div>
            </div>
            <div class="main-area d-b-60" ng-style="{'top': orderObj.billType === 2 || orderObj.billType === 3 ? '255px' : '225px'}">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{materielTableConfig.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in materielTableConfig.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-if="itemCol.type!=='cost'||costPriceShow">
                                    <div yb-thead-operate ng-model="itemCol" target-width="editMaterielConfig.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="orderObj.detailVOList.length > 0">
                        <table class="table-fixed border-none" width="{{materielTableConfig.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in orderObj.detailVOList track by $index">
                                <td class="spill-dots" ng-repeat="itemCol in materielTableConfig.tableCol track by $index"
                                    width="{{itemCol.width}}" title="{{item[itemCol.dataField]}}" ng-if="itemCol.type!=='cost'||costPriceShow">
                                    {{item[itemCol.dataField]}}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="orderObj.detailVOList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-default" ng-click="cancel()">返回</button>
            </div>
        </div>
    </div>
</div>
